package com.huarui.purchaseOrder.action;

import java.util.List;


import net.sf.json.JSONArray;

import org.ewaf.framework.action.BaseAction;
import com.huarui.area.model.Area;
import com.huarui.area.service.AreaService;
import com.huarui.dictionary.DictionaryEnum;
import com.huarui.dictionary.model.Dictionary;
import com.huarui.dictionary.service.DictionaryReadOnlyService;
import com.huarui.params.Params;

public class PurchaseInputAction extends BaseAction {

	public static final String TO_INPUT = "to_input";
	
	private static final long serialVersionUID = 8311499683392191433L;
	
	private DictionaryReadOnlyService dictionaryReadOnlyService;
	private AreaService areaService;
	
	/**
	 * 来源详细组合
	 */
	private String joSources;
	/**
	 * 运输方式组合
	 */
	private String joTransportType;
	/**
	 * 地区信息组合
	 */
	private String joAreas;
	/**
	 * 支付方式
	 */
	private String joPayTypes;
	/**
	 * 省份信息
	 */
	private String joProvs;
		
	private Integer orderId;
	
	private String status;
			
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Integer getOrderId() {
		return orderId;
	}

	public void setOrderId(Integer orderId) {
		this.orderId = orderId;
	}

	public String getJoProvs() {
		return joProvs;
	}

	public void setJoProvs(String joProvs) {
		this.joProvs = joProvs;
	}

	public String getJoSources() {
		return joSources;
	}

	public void setJoSources(String joSources) {
		this.joSources = joSources;
	}

	public String getJoPayTypes() {
		return joPayTypes;
	}

	public void setJoPayTypes(String joPayTypes) {
		this.joPayTypes = joPayTypes;
	}

	
	public String getJoTransportType() {
		return joTransportType;
	}

	public void setJoTransportType(String joTransportType) {
		this.joTransportType = joTransportType;
	}

	public String getJoAreas() {
		return joAreas;
	}

	public void setJoAreas(String joAreas) {
		this.joAreas = joAreas;
	}

	public void setDictionaryReadOnlyService(
			DictionaryReadOnlyService dictionaryReadOnlyService) {
		this.dictionaryReadOnlyService = dictionaryReadOnlyService;
	}
	
	public void setAreaService(AreaService areaService) {
		this.areaService = areaService;
	}

	public String toInput() {
		List<Dictionary> source_list = this.dictionaryReadOnlyService.getDictionaryByGroup(DictionaryEnum.GROUP_SOURCE);
		JSONArray source_ja = JSONArray.fromObject(source_list);
		this.joSources = source_ja.toString();
		List<Dictionary> tran_list = this.dictionaryReadOnlyService.getDictionaryByGroup(DictionaryEnum.GROUP_TRANSPORT_TYPE);
		JSONArray tran_ja = JSONArray.fromObject(tran_list);
		this.joTransportType = tran_ja.toString();
		List<Dictionary> pay_list = this.dictionaryReadOnlyService.getDictionaryByGroup(DictionaryEnum.GROUP_PAY_TYPE);
		JSONArray pay_ja = JSONArray.fromObject(pay_list);
		this.joPayTypes = pay_ja.toString();
//		this.joAreas = AreaCashBean.getAREA_MESS_JSON().toString();
		List<Area> provs = this.areaService.getProvs();
		this.joProvs = JSONArray.fromObject(provs).toString();
		return TO_INPUT;
	}
	
	public String toOutInput() {
		return TO_INPUT;
	}
	
	public String toShowPur() {
		return Params.PURCHARSE_TO_QUERY_STRING;
	}
	
	public String toShowDetails() {
		return Params.PURCHARSE_TO_QUERY_STRING;
	}
	
}
